<?php


namespace app\xcxapi\controller\v1;

use app\common\controller\XcxController;
use app\xcxapi\service\FinanceService;

class Finance extends XcxController
{
    /**
     * 财务汇总
     * User: wufeng
     * Date: 2020/02/21.
     */
    public function financeSummary()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new FinanceService($this->type))->financeSummary($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }

    /**
     * 校区收款汇总
     * User: wufeng
     * Date: 2020/02/21.
     */
    public function campusReceivablesSummary()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new FinanceService($this->type))->campusReceivablesSummary($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }

    /**
     * 个人收款汇总
     * User: wufeng
     * Date: 2020/02/21.
     */
    public function personalReceivablesSummary()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new FinanceService($this->type))->personalReceivablesSummary($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }

    /**
     * 退款汇总
     * User: wufeng
     * Date: 2020/02/21.
     */
    public function refundSummary()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new FinanceService($this->type))->refundSummary($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }

    /**
     * 缴款确认
     * User: wufeng
     * Date: 2020/02/21.
     */
    public function paymentConfirmation()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new FinanceService($this->type))->paymentConfirmation($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }

	/**
	 * 审核
	 * User: wufeng
	 * Date: 2020/03/20
	 *
	 */
    public function examine()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new FinanceService($this->type))->examine($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }

    /**
     * 订单记录
     * User: wufeng
     * Date: 2020/02/21.
     */
    public function orderLists()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new FinanceService($this->type))->orderLists($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }

	/**
	 * 修改订单
	 * User: wufeng
	 * Date: 2020/03/19
	 *
	 */
    public function orderEdit()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new FinanceService($this->type))->orderEdit($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }

	/**
	 * 收款归属、支付方式、校区、收款人、收款凭证
	 * User: wufeng
	 * Date: 2020/03/19
	 *
	 */
    public function pickUpInformation()
    {
        if ($this->request->isPost()) {
            $list = (new FinanceService($this->type))->pickUpInformation();
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }
	
	/**
	 * 项目详情
	 * User: chenben
	 * Date: 2020/04/04
	 *
	 */
    public function projectDetail()
    {
        if ($this->request->isPost()) {
			$params = $this->request->param();
            $list = (new FinanceService($this->type))->projectDetail($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }

    /**
     * 收款
     * User: wufeng
     * Date: 2020/02/21.
     */
    public function receivables()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new FinanceService($this->type))->receivables($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }
	
	
	/**
     * 提交资金分配记录
     * User: chenben
     * Date: 2020/04/25.
     */
    public function referAllocation()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new FinanceService($this->type))->referAllocation($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }
	
	
	/**
     * 资金分配记录
     * User: chenben
     * Date: 2020/04/25.
     */
    public function getContractinfo()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new FinanceService($this->type))->getContractinfo($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }

    /**
     * 学费分配列表
     * User: wufeng
     * Date: 2020/02/21.
     */
    public function tuitionAllocation()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new FinanceService($this->type))->tuitionAllocation($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }

	/**
	 * 添加业绩
	 * User: chenben
	 * Date: 2020/03/22
	 *
	 */
    public function addAchievement()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new FinanceService($this->type))->addAchievement($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }
	
	/**
	 * 业绩分配
	 * User: wufeng
	 * Date: 2020/03/20
	 *
	 */
    public function performanceAllocation()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new FinanceService($this->type))->performanceAllocation($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }

	/**
	 * 业绩删除
	 * User: wufeng
	 * Date: 2020/03/21
	 *
	 */
    public function performanceDel()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new FinanceService($this->type))->performanceDel($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }

    /**
     * 订单详情
     * User: wufeng
     * Date: 2020/02/21.
     */
    public function orderDetail()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new FinanceService($this->type))->orderDetail($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }

    /**
     * 订单退费
     * User: wufeng
     * Date: 2020/02/21.
     */
    public function orderRefund()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new FinanceService($this->type))->orderRefund($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }
	
	
    /**
     * 订单退费提交
     * User: chenben
     * Date: 2020/04/25.
     */
    public function saverefund()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new FinanceService($this->type))->saverefund($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }

    /**
     * 业绩分配记录
     * User: wufeng
     * Date: 2020/02/21.
     */
    public function performanceDistributionRecord()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new FinanceService($this->type))->performanceDistributionRecord($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }

    /**
     * 业绩分配
     * User: wufeng
     * Date: 2020/02/21.
     */
    public function performanceDistribution()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new FinanceService($this->type))->performanceDistribution($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }
}
